{% extends "goods/base_goods.html" %}

{% block content %}
    <div class="breadcrumb">
		<a href="#">全部分类</a>
		<span>&gt;</span>
		<a href="#">{{ category.category_name }}</a>
	</div>
    <div class="main_wrap clearfix">
		<div class="l_wrap fl clearfix">
			<div class="new_goods">
				<h3>新品推荐</h3>
				<ul>
                    {% for new in news %}
                        <li>
                            <a href="/goods/detail/{{ new.id }}"><img src="{{ new.pic }}"></a>
                            <h4><a href="/goods/detail/{{ new.id }}">{{ new.goods_name }}</a></h4>
                            <div class="prize">￥{{ new.price }}</div>
                        </li>
                    {% endfor %}
				</ul>
			</div>
		</div>

		<div class="r_wrap fr clearfix">
			<div class="sort_bar">
				<a href="/goods/list/{{ category.id }}/default/"
                    {% if sort == "default" %}
                        class="active"
                    {% endif %}>默认</a>
				<a href="/goods/list/{{ category.id }}/price/"
                    {% if sort == "price" %}
                        class="active"
                    {% endif %}>价格</a>
				<a href="/goods/list/{{ category.id }}/popular/"
                    {% if sort == "popular" %}
                        class="active"
                    {% endif %}>人气</a>

			</div>

			<ul class="goods_type_list clearfix">
                {% for goods in page %}
                    <li>
                        <a href="/goods/detail/{{ goods.id }}/"><img src="{{ goods.pic }}"></a>
                        <h4><a href="/goods/detail/{{ goods.id }}/">{{ goods.goods_name }}</a></h4>
                        <div class="operate">
                            <span class="prize">￥{{ goods.price }}</span>
                            <span class="unit">{{ goods.price }}/{{ goods.unit }}</span>
                            <a title="加入购物车" class="add_goods" href="#"></a>
                        </div>
                    </li>
                {% endfor %}

			</ul>

			<div class="pagenation">
                {% if page.has_previous %}
                    <a href="/goods/list/{{ category.id }}/{{ sort }}/{{ page.previous_page_number }}/"><上一页</a>
                {% endif %}

	            {% for num in page.paginator.page_range %}
                    {% if page_num == num %}
                        <a href="/goods/list/{{ category.id }}/{{ sort }}/{{ num }}/" class="active">{{ num }}</a>
                    {% else %}
                        <a href="/goods/list/{{ category.id }}/{{ sort }}/{{ num }}/">{{ num }}</a>
                    {% endif %}
                {% endfor %}

                {% if page.has_next %}
                    <a href="/goods/list/{{ category.id }}/{{ sort }}/{{ page.next_page_number }}/">下一页></a>
                {% endif %}
			</div>
		</div>
	</div>
{% endblock %}